import request from "../utils/request";

export const checklogin=(data)=> {
    return request.post('/users/checkLogin',data)
}

//添加账户
export const addaccount=(data)=> {
    return request.post('/users/add',data )
}

//删除账号传id
export const del=(params)=>{
    return request.get('/users/del',{params:params})
}

//批量删除账户
export const delallaccount=(data)=> {
    return request.get('/users/batchdel', { params: data });
}

// 获取账号列表
export const getaccount = (data) => {
    return request.get('/users/list', { params: data }); 
  };

//获取个人中心

export const getaccountinfo = (data) => {
    return request.get('/users/accountinfo', { params: data });
}
//批量删除用户
export const batchdel=(ids)=>{
    const idsStr = JSON.stringify(ids);
    return request.get('/users/batchdel',{params:{ids:idsStr}})
}

// 修改账号密码
export const revise = (data) => {
    return request.post('/users/editpwd',data );
}
// 修改账号
export const reviseaccount = (data) => {
    return request.post('/users/edit',data );
}
//上传头像
export const imguploadaccount = (data) => {
    return request.post('/users/avatar_upload',data);
}


// 商品管理
//   商品列表
export const getgoods = (data) => {
    return request.get('/goods/list', { params: data }); 
}
// 添加分类
export const addcategory = (data) => {
    return request.post('/goods/addcate',data );
}

// 获取分类页码

export const getcategory = (data) => {
    return request.get('/goods/catelist', { params: data });    
}

//修改分类
export const updatecategory = (data) => {
    return request.post('/goods/editcate',data );
}
// 删除分类
export const delcategory = (data) => {
    return request.get('/goods/delcate', { params: data });    
}

//   添加商品
export const addgoods = (data) => {
    return request.post('/goods/add',data );
}

//上传图片
export const imgupload = (data) => {
    return request.post('/goods/goods_img_upload',data );
}
// 删除商品
export const delgoods = (data) => {
    return request.get('/goods/del', { params: data });
}

// 修改商品
export const updateGoods = (data) => {
    return request.post('/goods/edit',data );
}

// //获取商品分类
export const getGoodsCate = (data) => {
    return request.get('/goods/categories', { params: data });
}

//订单管理
//获取订单列表
export const getorder = (data) => {
    return request.get('/order/list', { params: data });
}
//查看订单
export const getorderinfo = (data) => {
    return request.get('/order/detail', { params: data });
}
//修改订单
export const updateorder = (data) => {
    return request.post('/order/edit',data );
}